package cn.kuporo.seckill.common.model.message;

import cn.kuporo.seckill.common.model.enums.PlaceOrderType;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: kuporo
 * @since: 2025/7/11
 * @description: 错误消息，扣减库存失败，由商品微服务发送给订单微服务
 */
@Data
@NoArgsConstructor
public class ErrorMessage extends TopicMessage{
    /**
     * 全局事务编号
     */
    private Long txNo;
    /**
     * 商品id
     */
    private Long goodsId;
    /**
     * 购买数量
     */
    private Integer quantity;
    /**
     * 下单的类型
     */
    private PlaceOrderType placeOrderType;
    /**
     * 是否扣减了缓存库存
     */
    private Boolean exception;

    /**
     * 库存分桶编号
     */
    private Integer bucketSerialNo;

    /**
     * 用户id
     */
    private Long userId;
    
    /**
     * 订单任务id
     */
    private String orderTaskId;

    public ErrorMessage(String destination, Long txNo, Long goodsId, Integer quantity, PlaceOrderType placeOrderType, Boolean exception, Integer bucketSerialNo,Long userId, String orderTaskId) {
        super(destination);
        this.txNo = txNo;
        this.goodsId = goodsId;
        this.quantity = quantity;
        this.placeOrderType = placeOrderType;
        this.exception = exception;
        this.bucketSerialNo = bucketSerialNo;
        this.userId = userId;
        this.orderTaskId = orderTaskId;
    }
}
